package hu.tortavar.client.ui;

import hu.tortavar.client.data.OpeningHoursData;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class OpeningHours extends Composite {
	
	interface OpenTimes extends CssResource {
		String nyitva();
		String zarva();
	}

	private static OpeningHoursUiBinder uiBinder = GWT
			.create(OpeningHoursUiBinder.class);

	interface OpeningHoursUiBinder extends UiBinder<Widget, OpeningHours> {
	}

	@UiField OpenTimes style;
	@UiField VerticalPanel nyitvatartas;
	@UiField HTML msg;
	
	OpeningHoursData oh = new OpeningHoursData();
	
	public OpeningHours() {
		initWidget(uiBinder.createAndBindUi(this));
		
		msg.setHTML(oh.toHTML());
		
		getElement().addClassName(style.nyitva());
		
		if (oh.isOpenNow()) {
			getElement().addClassName(style.nyitva());
		} else {
			getElement().addClassName(style.zarva());
		}
		
	}
}
